A further beatdown on binary option handling in the GUI. I think it
authorrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 31 Dec 2013 01:23:58 +0000 (01:23 +0000)
committerrobertlipe <robertlipe@f51c46e8-681c-474f-0cfe-069cfd0219fb>
Tue, 31 Dec 2013 01:23:58 +0000 (01:23 +0000)
finally works sensibly now.

git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@4669 f51c46e8-681c-474f-0cfe-069cfd0219fb

gpsbabel/gui/mainwindow.cc
gpsbabel/gui/optionsdlg.cc

index f77d885869fe9d8e1ec9dc98f0783d627cd2b921..63fe218b66014e1cda5b2cb317391d9497235edb 100644 (file)
@@ -27,6 +27,7 @@
 #include <QSettings>
 #include <QTemporaryFile>
 #include <QTextStream>
+// #include <QDebug>
 
 #include "mainwindow.h"
 #include "../gbversion.h"
@@ -112,11 +113,12 @@ static QString MakeOptions(const QList<FormatOption>& options)
   QString str;
   for (int i = 0; i< options.size(); i++) {
     FormatOption option = options[i];
+    QVariant default_value = option.getDefaultValue();
     if (option.getSelected()) {
       // For OPTbool, 'selected' is the key, not value.
      if (option.getType() == FormatOption::OPTbool) {
        // Only write "foo=1" if that's not already the default.
-       if (option.getDefaultValue() != "1") {
+       if (default_value != "1") {
           str += "," + option.getName() + "=1";
         }
       } else {
@@ -127,8 +129,8 @@ static QString MakeOptions(const QList<FormatOption>& options)
       // turn it off here, but only if the default isn't zero
       // or given.
       if (option.getType() == FormatOption::OPTbool &&
-          option.getDefaultValue() != "0" &&
-          option.getDefaultValue() != "") {
+          default_value != "0" &&
+          default_value != "") {
             str += "," + option.getName() + "=0";
         }
       }
index d67fefa44a8fd2e212c847daf9f740dc4200166a..6cb8c521ea0851de96ce54440d2959cddc72e703 100644 (file)
@@ -134,10 +134,8 @@ OptionsDlg::OptionsDlg(QWidget* parent,  const QString& fmtName, QList<FormatOpt
     break;
 
     case FormatOption::OPTbool:
-      // This is quirky.  It means that GPSBabel's bool options that default
-      // to true get turned on here, even if user turned them off on last
-      // exit.
-      checkBox->setChecked(getOptionValue(options_,k).toBool());
+      // If it was selected before, select it again.
+      checkBox->setChecked(options_[k].getSelected());
       w = 0;
       break;